//
//  tb2ViewController.m
//  Lesson
//
//  Created by centling on 15/4/15.
//  Copyright (c) 2015年 Seas.CHENG. All rights reserved.
//

#import "tb2ViewController.h"
#import "tbCellTableViewCell.h"
#import "User.h"
#import "NetworkClient.h"

@interface tb2ViewController ()

@end

@implementation tb2ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.tableview.delegate=self;
    self.tableview.dataSource=self;
    
    //
//    http://api.map.baidu.com/telematics/v3/weather?location=%E5%98%89%E5%85%B4&output=json&ak=5mEfnX5vSwC8Kj9mCuxhEe9q&mcode=com.centling.Lesson
    
    [[NetworkClient intance] getWeather:@"青岛" completionBlock:^void(Weather *weather, NSError *error) {
        NSLog(@"返回参数：%@",weather);
    }];
    
    
    
    // Do any additional setup after loading the view.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 5;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    static NSString *cellStr=@"tbcell2";
    tbCellTableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellStr];
    if (cell==nil) {
        cell=[[tbCellTableViewCell alloc] init];
    }
    
    User *user=[[User alloc] init];
    user.userName=@"myname";
    user.userAge=@"10";
    
    cell.nameLabel.text=user.userName;
    cell.ageLabel.text=user.userAge;
    // Configure the cell...
    
    return cell;
    
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    NSLog(@"点击了：%ld",(long)indexPath.row);
}


- (IBAction)backButtonClick:(id)sender {
    [self dismissViewControllerAnimated:YES completion:nil];
}
@end
